#alpine为缩减版的容器 占用磁盘小 有个缺陷-连接不了宿主机的服务 例如mysql redis mq这些 想不到啥办法解决
FROM php:8.1-fpm-alpine
COPY ./php.ini /usr/local/etc/php/php.ini
RUN apk update \
 && apk add --no-cache \
    curl make gcc g++ autoconf libc-dev \
    #下面这些依赖是为了安装swoole
    c-ares c-ares-dev curl-dev openssl-dev \
    #phpize
    php-pear \
    #gd依赖
    zlib-dev \
    libpng-dev \
    #zip依赖
    libzip-dev \
    #amqp依赖
    rabbitmq-c \
    rabbitmq-c-dev \
 && pecl install redis \
    --enable-redis-igbinary=no \
    --enable-redis-lzf=no \
    --enable-redis-zstd=no \
    --enable-redis-msgpack=no \
    --enable-redis-lz4=no \
  amqp \
  && pecl install -D 'enable-sockets="no" enable-openssl="yes" enable-http2="yes" enable-mysqlnd="yes" enable-swoole-json="no" enable-swoole-curl="yes" enable-cares="yes"' swoole \
  && docker-php-ext-enable redis amqp swoole \
  && docker-php-ext-install pdo pdo_mysql mysqli pcntl bcmath sockets gd zip \
#安装composer
  && curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
  && composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ \
  && composer self-update
#命令
CMD ["php-fpm"]